import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
import Images;

import CustomSprite;

class Button extends CustomSprite {
public function new(inWidth:Int,inHeight:Int,inText:String, ?backgroundColor:Int = 0x000000,?textColor:Int = 0xFFFFFF){
super();
  var image = new GenericButton();
  this.graphics.beginFill(backgroundColor);
  this.graphics.lineStyle(1, textColor);
  this.graphics.drawRect(0, 0, inWidth, inHeight);
  this.graphics.endFill();
  //this.resize(inWidth,inHeight);
  var text = new TextField();

text.htmlText= "<font color='#"+HelperMethods.Dec2Hex(textColor)+"' size='16'>"+inText+"</font>";
  
  addChild(text);
  var myFormat:TextFormat = new TextFormat();
  //myFormat.size = 15;
  text.width = inWidth;
  text.autoSize = TextFieldAutoSize.CENTER;

  //Turning off for now
  text.y = (inHeight-32) / 2;
  text.selectable = false;
  text.mouseEnabled = false;
//   var myBitmapData = new BitmapData(Std.int(text.width),Std.int(text.height));
//   myBitmapData.draw(text);
//   var bmp = new Bitmap(myBitmapData);
//   removeChild(text);
//   addChild(bmp);
  //trace(text.y); trace(height);trace(text.height);


  
}


}